package com.flyox.game.militarychess.client;

import java.awt.Dimension;
import java.awt.Toolkit;

import com.flyox.game.militarychess.client.control.MainControl;
import com.flyox.game.militarychess.client.view.ChessFrame;
import com.flyox.game.militarychess.client.view.LoginJDialog;

public class Start {

	public static void main(String[] args) {
		//ChessClientHandler handler=new ChessClientHandler();
		MainControl mc=new MainControl();
		//stept 1   login
		LoginJDialog inst = new LoginJDialog(mc,null);
		inst.setLocationRelativeTo(null);
		inst.setVisible(true);
		if(inst.isCanceled()){
			System.exit(0);
		}
		
//		mc.setLoginView(inst);
//		mc.setSession(inst.getSession());
		
		//stept 3
		ChessFrame chessFrame = new ChessFrame(mc);
		mc.setView(chessFrame);
		// inst.setLocationRelativeTo(null);
		Dimension winSize = Toolkit.getDefaultToolkit().getScreenSize(); // 屏幕分辨率
		chessFrame.setLocation((winSize.width - chessFrame.getWidth()) / 2, (winSize.height - chessFrame.getHeight()) / 2);
		chessFrame.setVisible(true);
		
	}

}
